class Solution {
public:
    int maximumNumberOfStringPairs(vector<string>& words) {
        unordered_map<string, int>mp;
        for (auto x : words) {
            mp[x]++;
        }
        int ans = 0;
        for (auto x : words) {
            if (!mp[x])continue;
            bool f = 0;
            for (int i = 1; i < x.size(); i++) {
                if (x[i] != x[i - 1]) {
                    f = 1;
                    break;
                }
            }
            if (!f) {
                ans += mp[x] / 2;
                mp[x] = 0;
                continue;
            }
            string y = x;
            reverse(x.begin(), x.end());
            string t = x;
            cout << t << endl;
            if (mp[t]) {
                mp[t]--;
                mp[y]--;
                ans += 1;
            }
        }
        return ans;
    }
};